package com.gt.web.controller.app;

import com.gt.app.domain.dto.EsUseDrugInfoDto;
import com.gt.app.service.EsUseDrugInfoService;
import com.gt.common.core.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.python.compiler.APIVersion;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 服用药物情况表 前端控制器
 * </p>
 *
 * @author caidesheng
 */
@Slf4j
@RestController
@RequestMapping("esUseDrugInfo")
@Api(tags = "服用药物情况接口")
public class EsUseDrugInfoController {

    @Autowired
    private EsUseDrugInfoService esUseDrugInfoService;

    @ApiOperation(value = "新增服用药物情况")
    @PostMapping(value = "add")
    public AjaxResult add(@RequestBody EsUseDrugInfoDto esUseDrugInfoDto) {
        esUseDrugInfoService.add(esUseDrugInfoDto);
        return AjaxResult.success();
    }

    @ApiOperation(value = "根据checkId获取服用药物情况")
    @GetMapping(value = "getDrugInfo")
    public AjaxResult getDrugInfo(String checkId) {
        EsUseDrugInfoDto drugInfo = esUseDrugInfoService.getDrugInfo(checkId);
        return AjaxResult.success(drugInfo);
    }

}
